#include <stdio.h>
#include <string.h>

#include "../rid.h"

#define DAT_DIR "dat/"
#define DAT_DIR_LEN (sizeof(DAT_DIR) - 1)

typedef char Dir_path[DAT_DIR_LEN + sizeof(Rid_path)];

int
main(int argc, char *argv[])
{
	Rid id1;
	Rid id2;
	Rid_str str;
	Rid_path path;
	Dir_path dir_path;

	rid_set(id1, NULL);
	rid_str(str, id1);
	printf("id1 str: %s\n", str);

	rid_set(id2, id1);
	rid_str(str, id2);
	printf("id2 str: %s\n", str);

	printf("compare: %i\n\n", !rid_cmp(id1, id2));

	rid_set(id2, NULL);
	rid_str(str, id2);
	printf("new id2 str: %s\n", str);

	printf("compare: %i\n\n", !rid_cmp(id1, id2));

	rid_path(path, id1);
	printf("id1 as path: %s\n", path);

	rid_path(path, id2);
	printf("id2 as path: %s\n", path);

	strcpy(dir_path, DAT_DIR);
	rid_path(dir_path + DAT_DIR_LEN, id1);
	printf("id1 as sub-path: %s\n\n", dir_path);

	printf("to parse: %s\n", "0ad51d5b881663d409946101ab04092f");
	printf("chars parsed: %i/%i\n",
	       rid_parse(id1, "0ad51d5b881663d409946101ab04092f"),
	       RID_LEN);
	rid_str(str, id1);
	printf("parsed result: %s\n", str);
}
